package com.common.boot.exception;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 业务逻辑异常(处理事务回滚依据)
 * @author xuqq
 * @date 2020-09-09
 * @version v1.0
 */
@Data
@EqualsAndHashCode(callSuper=false)
public class BusinessException extends RuntimeException {
    /**
     * 异常代码
     */
    private String code="-1";

    /**
     * 构造函数
     * @param message 异常信息
     */
    public BusinessException(String message){
        super(message);
    }

    /**
     * 构造函数
     * @param exceptionStatus 异常状态信息
     */
    public BusinessException(ExceptionStatus exceptionStatus){
        super(exceptionStatus.getMsg());
        this.code = exceptionStatus.getCode();
    }
}
